package se137.hrbust.hlgshopping137.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import se137.hrbust.hlgshopping137.service.OrderInfo137Service;
import se137.hrbust.hlgshopping137.utils.Result137;
import se137.hrbust.hlgshopping137.vo.OrderVO137;
@RestController
@RequestMapping("/order")
public class OrderController137 {
    @Autowired
    private OrderInfo137Service orderInfo137Service;
    @PostMapping("/add")
    public Result137 addOrder(OrderVO137 orderVO137)
    {
        return orderInfo137Service.addOrder(orderVO137);
    }
    @PostMapping("/updateOrderState/{id}/{state}")
    public Result137 updateOrderState(@PathVariable("id") Long id, @PathVariable("state") Integer state){
        return orderInfo137Service.updateOrderState(id,state);
    }
    @PostMapping("/delete/{id}")
    public Result137 deleteOrder(@PathVariable("id") Long id){
        return orderInfo137Service.deleteOrder(id);
    }

}
